/*
 * @Date: 2024-07-02 16:36:17
 * @LastEditTime: 2024-07-06 09:12:02
 * @FilePath: \NewProject\assets\Scripts\cameraControllers.ts
 */
import { _decorator, Component, EventTouch, input, Input, Node } from 'cc';
const { ccclass, property } = _decorator;

@ccclass('cameraControll')
export class cameraControll extends Component {
    start() {
        input.on(Input.EventType.TOUCH_START, this.onTouchStart, this);
        input.on(Input.EventType.TOUCH_END, this.onTouchEnd, this);
        input.on(Input.EventType.TOUCH_MOVE, this.onTouchMove, this);
    }
    onTouchStart(event:EventTouch) {
       console.log('ii',event.getLocation())
    } 
    onTouchEnd(event:EventTouch) {
       console.log('ii',event.getLocation())
    } 
    onTouchMove(event:EventTouch) {
        console.log('ii',event.getDelta())
        const moveScale = 0.05;
        const pos = this.node.position;
        this.node.setPosition(pos.x+event.getDelta().x*moveScale,pos.y+event.getDelta().y*moveScale,pos.z)
    }
    update(deltaTime: number) {

    }
}


